import request from './request'
import { useUserStore } from "../store/modules/user"

/**
 * 获取商家微信授权信息
 * @returns 
 */
export function getCustomerWxAuthor() {
    let token = {
        'access-token': useUserStore().token
    }
    return request({
        url: '/customer/wx/author/getCustomerWxAuthor',
        method: 'GET',
        headers: token
    })
}

/**
 * 获取微信第三方平台授权
 */
export function getWxThridAuthorizePage(uuid: string) {
    let token = {
        'access-token': useUserStore().token
    }
    return request({
        url: `/wx/publicNo/authorizeThird/getWxThridAuthorizePage/${uuid}` ,
        method: 'GET',
        headers: token
    })
}

/**
 * 保存商家取消微信授权
 * @returns 
 */
export function cancelCustomerWxAuthor() {
    let token = {
        'access-token': useUserStore().token
    }
    return request({
        url: `/wx/publicNo/authorizeThird/saveCancelCustomerWxAuthor` ,
        method: 'PUT',
        headers: token
    })
}